home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_09_07
/
9n07097a
< prev
next >
Wrap
Text File
|
1991-05-26
|
1KB
|
53 lines
XEvent event;
int length;
char new_string[ 12 ];
KeySym keysym;
XComposeStatus composestatus;
length = XLookupString( &event,
new_string, 1, /* 1 = max length */
&keysym, &composestatus );
new_string[1] = '\0'; /* some systems add garbage */
/*
* This is a US ASCII test,
* so you may need to change this.
*/
if ( ( length > 0 ) && ( keysym > 31 ) &&
( keysym < 127 ) )
{
/*
* We have alphanumeric keyboard input
*/
}
else
{
/*
* Test for some special keys.
* This is not an exhaustive list.
*/
switch( keysym )
{
case XK_Return: /* Return key */
break;
case XK_Escape:
break;
case XK_BackSpace:
break;
case XK_Delete:
break;
case XK_Right: /* right arrow */
break;
case XK_Prior: /* PageUp to DOS folks */
break;
case XK_Next: /* PageDn to DOS folks */
break;
case XK_F1: /* functionkey 1 */
break;
}
}